package lib

import (
	"crypto/tls"
	"fmt"
	"io/ioutil"
	"net/http"
	"strings"
	"time"
)

func FingerPrint(url string) bool {
	cli := &http.Client{Transport: &http.Transport{
		TLSClientConfig: &tls.Config{InsecureSkipVerify: true}},
		Timeout: time.Second * 5}
	get, err := cli.Get("https://" + url + "/owa/auth/logon.aspx?re" +
		"placeCurrent=1&url=https%3a%2f%2f" + url + "%2fowa")
	if err != nil {
		panic(err)
	} else {
		defer func() {
			_ = get.Body.Close()
		}()
	}

	all, err := ioutil.ReadAll(get.Body)
	if err != nil {
		panic(err)
	}
	responseString := fmt.Sprintf("%s", all)
	if strings.Contains(responseString, "<!-- OwaPage = ASP.auth_logon_aspx -->") == true {
		return true
	}
	return false
}

